const { Sequelize, Model, DataTypes } = require('sequelize');

const sequelize = new Sequelize('mysql://root:root@127.0.0.1:3306/iai') 

class Article extends Model {}
Article.init(
  {
    id: {
      type: DataTypes.INTEGER,
      autoIncrement: true,
      primaryKey: true,
    },
    title: {
      type: DataTypes.STRING,
      // allowNull defaults to true
    },
    content: {
      type: DataTypes.TEXT,
      // allowNull defaults to true
    },
  },
  { sequelize, modelName: 'fa_article' },
);

(async () => {
  await sequelize.sync();
//   const jane = await User.create({
//     username: 'janedoe',
//     birthday: new Date(1980, 6, 20),
//   });
//   console.log(jane.toJSON());
    const articles = await Article.findAll();
    console.log(articles);
    // console.log('Jane\'s auto-generated ID:', jane.id);
})();